import requests
from bs4 import BeautifulSoup

# 发送HTTP请求并获取网页内容
def fetch_page(url):
    response = requests.get(url)
    response.raise_for_status()  # 如果请求失败，抛出异常
    return response.text

# 解析网页内容并提取所有链接
def extract_links(html_content):
    soup = BeautifulSoup(html_content, 'html.parser')
    links = []
    for a_tag in soup.find_all('a', href=True):
        links.append(a_tag['href'])
    return links

# 示例网址
url = 'https://news.southcn.com/node_179d29f1ce/eb831161d6.shtml'

# 获取网页内容
html_content = fetch_page(url)

# 提取并打印所有链接
links = extract_links(html_content)
for link in links:
    print(link)
